{include file="../Public/header.html"}
<script type="text/javascript" src="__PUBLIC__/Js/jquery.SetTableBgColor.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/dataList.js"></script>
<script type="text/javascript">
var g = '{$smarty.const.GROUP_NAME}';
var m = '{$smarty.const.MODULE_NAME}';
var _hash_ = '{$_hash_}';
<!--{literal}-->
function del(id)
{
	$('#dialog>p').html('确定要删除吗？');
	$('#dialog').dialog('open');
	$('#dialog').dialog({
					autoOpen: false,
					width: 300,
					buttons: {
						"确定": function() { 
							var url = "?g="+g+"&m="+m+"&a=del_code&id="+id+"&ajax=1&_hash_="+_hash_;
							$.getJSON(url, function(data){
													if(data.status == 0){
														$('#dialog>p').html('删除失败');
														$('#dialog').dialog('open');
													}else{
														$('#dialog').dialog("close"); 
														$('#tt-item-'+id).remove();
													}
													});
						},
						"取消": function() { 
							$(this).dialog("close"); 
						}
					}
				});
}
$(document).ready(function(){
	$(".table-list").SetTableBgColor({
            odd:"even",
            even:"",
            selected:"",
            over:""
        });
});
<!--{/literal}-->
</script>
<div class="handle-btns">
	<div class="img-button "><p><input type="button" class="addData" onclick="window.location.href='?g={$smarty.const.GROUP_NAME}&m={$smarty.const.MODULE_NAME}&a=add_code&c_id={$code.c_id}'" value="添加" name="addData" id="addData"></p></div>
    <div class="img-button "><p><input type="button" class="addData" onclick="history.back();" value="返回上一页" name="addData" id="addData"></p></div>
</div>
<table cellspacing="0" cellpadding="0" border="0" class="table-list list" id="checkList">
<thead>
<tr>
<th width="30" class="first"><input type="checkbox" onclick="check_all('id[]', this)"></th>
<th width="200">名称</th>
<th align="left">优惠码</th>
<th width="80">密码</th>
<th width="80">领取人</th>
<th width="150">领取时间</th>
<th width="80">操作</th>
</tr>
</thead>
<tbody>
<!--{foreach from=$codes item=item}-->
<tr id="tt-item-{$item.id}">
<td class="first"><input type="checkbox" value="{$item.id}" name="id[]"></td>
<td align="left"><a href="?g={$smarty.const.GROUP_NAME}&m={$smarty.const.MODULE_NAME}&a=view&c_id={$code.c_id}">{$code.m_name}<!--{if $code.c_type==1}-->满{$code.money_max}减{$code.money_reduce}元优惠券<!--{else}-->{$code.money_amount}代金券<!--{/if}--></a></td>
<td align="left">{$item.code}</td>
<td>{$item.password|default:''}</td>
<td>{$item.nick|default:'未领取'}</td>
<td align="center">{$item.fetch_time|default:'未领取'}</td>
<td align="center"><!--{if $item.u_id == 0}--><a onclick="del({$item.id})" href="javascript:;">删除</a><!--{else}-->&nbsp;<!--{/if}--></td>
</tr>
<!--{/foreach}-->
</tbody></table>
<div class="pager">{$pagelink}</div>
{include file="../Public/footer.html"}